from typing import Optional
from pydantic import BaseModel, Field
from datetime import datetime

class CounselorBase(BaseModel):
    """辅导员基础信息"""
    department: Optional[str] = Field(None, description="部门")
    office_location: Optional[str] = Field(None, description="办公室位置")

class CounselorCreate(BaseModel):
    """创建辅导员的请求模型"""
    department: str = Field(..., description="部门")
    office_location: Optional[str] = Field(None, description="办公室位置")

class CounselorUpdate(CounselorBase):
    """更新辅导员的请求模型"""
    department: Optional[str] = Field(None, description="部门")
    office_location: Optional[str] = Field(None, description="办公室位置")

class CounselorInDB(CounselorBase):
    """数据库中的辅导员模型"""
    id: int
    user_id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True

class CounselorResponse(BaseModel):
    """辅导员响应模型"""
    department: str
    office_location: Optional[str] = None

    class Config:
        from_attributes = True